\documentclass[a4paper,twoside]{ctexart}
\usepackage{geometry}
\geometry{margin=1cm,vmargin={0pt,1cm}}
\setlength{\topmargin}{-2cm}
\setlength{\paperheight}{23cm}
\setlength{\paperwidth}{18cm}
\setlength{\textheight}{19.6cm}
\setlength{\textwidth}{15cm}
\usepackage{makecell}
\usepackage{fancyhdr}
\usepackage{siunitx}
\usepackage{amssymb}
\usepackage{indentfirst}
\setlength{\parindent}{0.5em}

\pagenumbering{arabic}

% useful packages.
\usepackage{multirow}
\usepackage{caption}
\usepackage{mathrsfs}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{enumerate}
\usepackage{xcolor,graphicx,float,subfigure}
\usepackage{epstopdf}
\usepackage{multicol}
\usepackage{fancyhdr}
\usepackage{layout}
\usepackage{listings}
\usepackage{diagbox}
\lstset{language=Matlab}
\lstset{breaklines}
\lstset{extendedchars=false}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\usepackage{xcolor}
\usepackage{cite}
\usepackage[numbers,sort&compress]{natbib}
\setcitestyle{open={},close={}}
%\usepackage{natbibspacing}
%\renewcommand{\refname}{}
\usepackage{anyfontsize}

% English theorem environment
\theoremstyle{definition}
\newtheorem{proposition}[section]{Proposition}
\newtheorem{corollary}[section]{Corollary}
\newtheorem{definition}{Definition}[section]
\newtheorem{remark}[section]{Remark}
\newtheorem{example}[definition]{Example}
\newtheorem{exercise}[definition]{Exercise}
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{lemma}[definition]{Lemma}
\newenvironment{solution}{\begin{proof}[Solution]}{\end{proof}}
\renewcommand{\proofname}{\noindent Proof}
% some common command
\newcommand{\dif}{\mathrm{d}}
\newcommand{\avg}[1]{\left\langle #1 \right\rangle}
\newcommand{\pdfrac}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\op}{\odot}
\newcommand{\Eabs}{E_{\mathrm{abs}}}
\newcommand{\Erel}{E_{\mathrm{rel}}}
\newcommand{\Ediv}{\mathrm{div}}%\div是除号
\newcommand{\lrq}[1]{\left( #1 \right)}
\newcommand{\avint}[1]{\frac{1}{\left|#1\right|}\int_{#1}}

\newcommand{\upcite}[1]{\textsuperscript{\textsuperscript{\cite{#1}}}} 

\makeatletter
\newcommand\sixteen{\@setfontsize\sixteen{17pt}{6}}
\renewcommand{\maketitle}{\bgroup\setlength{\parindent}{0pt}
\begin{flushleft}
\sixteen\bfseries \@title
\medskip
\end{flushleft}
\texttt{\@author}
\egroup}
\renewcommand{\maketag@@@}[1]{\hbox{\m@th\normalsize\normalfont#1}}
\makeatother
\setlength{\abovecaptionskip}{0.cm}
\setlength{\floatsep}{0.cm}
\setlength{\intextsep}{0.cm}

%\CTEXsetup[format={\Large\bfseries}]{section}

\title{微分方程数值解\ 第5次作业}
\author{李之琪 22235056}

\begin{document}
\maketitle
\section*{1.10.2}
对Euler法$\dfrac{u_{j}^{n+1}-u_j^n}{k} = (D_{+x_1}D_{-x_1} +
D_{+x_2}D_{-x_2} + D_{+x_3}D_{-x_3})u_j^n$，代入$u_j^n =
\dfrac{1}{\sqrt{2\pi}}\hat{v}^n(\omega)e^{i\left<\omega,x\right>}$，这
里$\omega = (\omega_1,\omega_2,\omega_3)$。整理得
\begin{eqnarray*}
  \begin{aligned}
    \hat{v}^{n+1}(\omega) - \hat{v}^n(\omega) =
    \frac{k}{h^2}\hat{v}^n(\omega)(e^{i\omega_1 h}-2+e^{-i\omega_1 h}+e^{i\omega_2 h}-2+e^{-i\omega_2 h}+e^{i\omega_3 h}-2+e^{-i\omega_3 h}).
  \end{aligned}
\end{eqnarray*}
记$\xi_i = \omega_i h, i = 1,2,3$，$\sigma = \dfrac{k}{h^2}$，得到
\begin{eqnarray*}
  \begin{aligned}
    \hat{v}^{n+1}(\omega)  =
    \left[1-4\sigma(\sin^2\frac{\xi_1}{2} + \sin^2\frac{\xi_2}{2} + \sin^2\frac{\xi_3}{2})\right]\hat{v}^n(\omega).
  \end{aligned}
\end{eqnarray*}
即
\begin{eqnarray*}
  \begin{aligned}
    \hat{Q}(\xi) = 
    1-4\sigma(\sin^2\frac{\xi_1}{2} + \sin^2\frac{\xi_2}{2} + \sin^2\frac{\xi_3}{2}).
  \end{aligned}
\end{eqnarray*}
注意到
\begin{eqnarray*}
  \begin{aligned}
    \sigma \le \frac{1}{6} \Longrightarrow  |\hat{Q}(\xi)| \le 1. 
  \end{aligned}
\end{eqnarray*}
即稳定性条件为$\sigma \le \dfrac{1}{6}$。类似地，对DuFort–Frankel法
\begin{eqnarray*}
  \begin{aligned}
\frac{u_{j}^{n+1}-u_j^n}{k} &=
\frac{1}{h^2}[(u_{j+1}^n-u_{j}^{n+1}-u_{j}^{n-1}+u_{j-1}^{n})_{x_1}\\
  &+(u_{j+1}^n-u_{j}^{n+1}-u_{j}^{n-1}+u_{j-1}^{n})_{x_2}+(u_{j+1}^n-u_{j}^{n+1}-u_{j}^{n-1}+u_{j-1}^{n})_{x_3}]
\end{aligned}
\end{eqnarray*}
代入$u_j^n =
\dfrac{1}{\sqrt{2\pi}}\hat{v}^n(\omega)e^{i\left<\omega,x\right>}$，整
理得
\begin{eqnarray*}
  \begin{aligned}
    (1+3\sigma)\hat{v}^{n+1}(\omega) -
    \left[1+2\sigma(\cos\xi_1 + \cos\xi_2 +
      \cos\xi_3)\right]\hat{v}^n(\omega) + 3\sigma
    \hat{v}^{n-1}(\omega) = 0.
  \end{aligned}
\end{eqnarray*}
其特征方程为
\begin{eqnarray*}
  \begin{aligned}
    z^2 -
    \frac{1+2\sigma(\cos\xi_1 + \cos\xi_2 +
      \cos\xi_3)}{1+3\sigma}z + \frac{3\sigma}{1+3\sigma}
    = 0.
  \end{aligned}
\end{eqnarray*}
解得
\begin{eqnarray*}
  \begin{aligned}
    z_{1,2} = \frac{1+2\sigma(\cos\xi_1 + \cos\xi_2 +
      \cos\xi_3) \pm \sqrt{\left[1+2\sigma(\cos\xi_1 + \cos\xi_2 +
      \cos\xi_3)\right]^2-12\sigma(1+3\sigma)}}{2(1+3\sigma)}.
  \end{aligned}
\end{eqnarray*}
结合$\cos\xi_1 + \cos\xi_2 +
\cos\xi_3 \in [-3,3]$，对任意$\sigma > 0 $，均有
\begin{eqnarray*}
  \begin{aligned}
    |z_{1,2}| \le 1.
  \end{aligned}
\end{eqnarray*}
即DuFort–Frankel法无条件稳定。
\section*{programming part}
针对方程$u_t - u_x = 0$，取$h =
2\pi/128, k = 10^{-3}$，终止时刻$T = \pi$，对三个不同的初值函
数，计算结果分别如下图所示。\\
\begin{figure}[!htp]   
  \centering
  \includegraphics[width=16cm]{Pictures/F1.eps}
  \caption{$u_t - u_x = 0$，初值函数(2.1.21)。(a)$p = 2$，(b)$p = 4$，(c)$p = 6$。}
  \label{fig:1}
\end{figure}
\begin{figure}[!htp]   
  \centering
  \includegraphics[width=16cm]{Pictures/F2.eps}
  \caption{$u_t - u_x = 0$，初值函数(2.1.22)。(a)$p = 2$，(b)$p = 4$，(c)$p = 6$。}
  \label{fig:2}
\end{figure}
\begin{figure}[!htp]   
  \centering
  \includegraphics[width=16cm]{Pictures/F3.eps}
  \caption{$u_t - u_x = 0$，初值函数(2.1.23)。(a)$p = 2$，(b)$p = 4$，(c)$p = 6$。}
  \label{fig:3}
\end{figure}
\newpage
上述结果可以通过运行\texttt{leapfrog\_highorder\_plot1.m}、
\texttt{leapfrog\_highorder\_plot2.m}和\texttt{leapfrog\_highorder\_plot3.m}文件得到。
\end{document}

